feat: add Go cgo wrapper for Rust trace writer FFI#16
Closed
zah wants to merge 11 commits intowasm-tracingfrom
Closed
feat: add Go cgo wrapper for Rust trace writer FFI#16zah wants to merge 11 commits intowasm-tracingfrom
zah wants to merge 11 commits intowasm-tracingfrom
Conversation
- Create tracewriter/ package with TraceRecorder interface - GoWriter wraps existing trace_record.TraceRecord (default) - RustTraceWriter wraps C FFI via cgo (opt-in with --use-rust-writer) - Buffer events during recording, replay through FFI in ProduceTrace() - Change ModuleInstance.Record to TraceRecorder interface - Update all call sites: store.go, runtime.go, stylus.go, stylus_funcs.go - Update wazero.nix to conditionally enable cgo with FFI library - GoWriter tests pass, full project compiles with CGO_ENABLED=0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Cast uint64 Address to uint32 for WASM32 memory reads - Add go.mod replace directive for local trace_record development Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Forward metadata in register_special_event (EVM hook names preserved) - Forward return values via register_return_int/raw dispatch - Forward workdir to trace_writer_set_workdir in ProduceTrace - Update local C header copy with new function declarations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add a GitHub Actions workflow that clones CodeTracer and trace_record, builds wazero from this PR, and runs the WASM flow integration test. This catches recorder changes that would produce incompatible traces. Follows the cross-repo testing pattern documented in codetracer-specs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fail fast with a clear error message if the secret is missing, rather than failing cryptically during submodule clone. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…guard - Add justfile with test, build, test-tracewriter, and check targets - Add tracewriter job to commit.yaml for pure Go tracewriter tests - Pin sibling codetracer ref to latest-trace-format branch - Add --test wasm_flow_integration flag + zero-test guard to integration workflow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The PR targets wasm-tracing, not main. Add wasm-tracing to the pull_request and push branch filters so the Test workflow runs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove stale dirs before clone (self-hosted runners persist) - Add sibling-pins debug output to diagnose ref resolution - Remove 2>/dev/null from python to surface errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Self-hosted NixOS runners don't have python3 on PATH. Use grep+sed to extract JSON values instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…l triggers The existing wazero tests in commit.yaml fail on wasm-tracing branch because go.mod has a replace directive for ../trace_record which doesn't exist in standard CI checkout. Move tracewriter tests to a dedicated workflow that clones trace_record at the pinned ref before running tests. Revert commit.yaml triggers back to main-only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The tracewriter package includes rust_writer.go with cgo, which requires libcodetracer_trace_writer_ffi. Set CGO_ENABLED=0 for test-tracewriter target to exclude the Rust FFI code. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
Author
|
Merged manually |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tracewriter/package withTraceRecorderinterface abstracting over Go and Rust trace writersGoWriterwraps existingtrace_record.TraceRecord(default, no behavior change)RustTraceWriterwraps C FFI via cgo (opt-in with--use-rust-writerflag)ModuleInstance.Recordfrom concrete*trace_record.TraceRecordtoTraceRecorderinterfacestore.go,runtime.go,stylus.go,stylus_funcs.gowazero.nixto conditionally enable cgo when FFI library is providedtrace_recordAddressuint64change (cast touint32for WASM32 memory reads)ProduceTraceDependencies
Test plan
CGO_ENABLED=0 go build ./...passes (full project without cgo)CGO_ENABLED=0 go test ./tracewriter/ -v— 5/5 GoWriter tests passgo vetreports no new warningsCGO_ENABLED=1 go test ./tracewriter/ -v(requires nix build oftrace-writer-ffi)🤖 Generated with Claude Code